<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>路政执法--登录</title>
    <link href="${ctx}/ui/pre/login/css/login.css" rel="stylesheet" type="text/css">
    <!-- 引入jQuery -->
    <script src="${ctx}/ui/jslib/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <!-- 扩展jQuery -->
    <script type="text/javascript" src="${ctx}/ui/jslib/extJquery.js?v=201305301341" charset="utf-8"></script>
    <script type="text/javascript" src="${ctx}/ui/jslib/check.js"></script>
    <script type="text/javascript">
        $(function(){
            createCode();
        });

        $(document).keyup(function(event){
            if(event.keyCode ==13){
                formSubmit();
            }
        });

        function formSubmit(){
            var ajaxCallUrl = '${ctx}/user/logins';
            if(validate()){
                $.ajax({
                    type: "POST",
                    url:ajaxCallUrl,
                    data:$.serializeObject($('#login')),
                    async: false,
                    error: function(request) {
                        alert(request);
                    },
                    success: function(data) {
                        if(data.success){
                            self.location = '${ctx}/user/logintoshow.shtml';
                        }else{
                            alert(data.msg);
                            $("#name").val('');
                            $("#pass").val('');
                            $("#checkNum").val('');
                            createCode();
                        }
                    }
                });
            }else{
                $("#name").val('');
                $("#pass").val('');
                $("#checkNum").val('');
                createCode();
            }
        }
    </script>
</head>
<body>
<div class="login_content">
    <div class="login_title"></div>
    <div class="login_user">
        <form id="login">
            <table border="0" cellspacing="0" cellpadding="0" class="login_user01">
                <tbody>
                <tr>
                    <td colspan="2" >
                        <input type="text" name="username" id="name"></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="password" name="password" id="pass" style="background:url(${ctx}/ui/pre/login/images/login_02.gif) no-repeat 15px 20px #ecf5fa"></td>
                </tr>
                <tr>
                    <td width="181"><input type="text" name="textfield" id="checkNum" style="background:#ecf5fa; width:160px; padding-left:0px;"></td>
                    <td width="119">
                        <span id="checkCode" onclick="javascript:createCode()"
                              style="color:#fff;border-radius:5px;
      	                             display:block;float: left;
      	                             background-color:#1A70AB;
      	                             height:35px;
      	                             line-height:35px;
      	                             margin-top:5px;
      	                             font-size:13px;
      	                             padding:5px;
                        ">
                        </span>
                    </td>
                </tr>
                </tbody>
            </table>
            <div style="margin-top:10px;width:300px; margin-left:auto; margin-right:auto;"><input onclick="javascript:formSubmit();"  style="width:107px; height:33px; background:url(${ctx}/ui/pre/login/images/login_03.gif) no-repeat; border:none; cursor:pointer;" type="button"></div>
        </form>
    </div>
    <p>路政执法</p>
</div>
</body>
</html>
